home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / More Source / C⁄C++ / picture / xscrn.h < prev   
Text File  |  1993-09-23  |  2KB  |  77 lines

  1. /*----------------------------------------------------------------------*\
  2. |   NAME:
  3. |       xscrn.h
  4. |
  5. |   AUTHOR:
  6. |       Donald C. Snow
  7. |
  8. |   PURPOSE:
  9. |       Definition of the XWindows Screen specific class, to encapsulate
  10. |       macine-specific graphics code.
  11. |
  12. |   HISTORY:
  13. |       Written during the Fall 91 Semester at Rutgers University
  14. |       for an independent study course.
  15. |
  16. |    MODIFIED:    9/23/93 Ralph Gonzalez
  17. |
  18. \*----------------------------------------------------------------------*/
  19.  
  20.  
  21. #ifndef xscrn_h
  22. #define xscrn_h
  23.  
  24.  
  25. #include <X11/Xlib.h>
  26. #include <X11/Xutil.h>
  27.  
  28. #include "screen.h"
  29.  
  30. #define    BORDER_WIDTH    0
  31.  
  32. // X has alot more colors, but we're following the code in color.h 
  33. #define maxPixels     8
  34.  
  35. /*----------------------------------------------------------------------*\
  36. |       X_Screen class to allow graphics I/O on any XWindows display
  37. \*----------------------------------------------------------------------*/
  38.  
  39. #define SCREEN X_Screen
  40. class X_Screen:public Generic_Screen
  41. {
  42. private:
  43.   Display     *theDisplay;
  44.   int         theDepth;
  45.   int        theScreen;
  46.   unsigned long    theBlackPixel;
  47.   unsigned long    theWhitePixel;
  48.  
  49.   unsigned long        thePixels[maxPixels];
  50.   char            *theColorNames[maxPixels];    // moved initialization to constructor - Ralph Gonzalez 9/23/93
  51.   Colormap    theColormap;
  52.  
  53.   Window    theWindows[MAX_WINDOWS];
  54.   GC        theGC;
  55.   
  56.   Window    *current_window;    // moved initialization to constructor - Ralph Gonzalez 9/23/93
  57.   unsigned long    *current_color;    // moved initialization to constructor - Ralph Gonzalez 9/23/93
  58.   int        penX,penY;            // moved initialization to constructor - Ralph Gonzalez 9/23/93
  59.   
  60. public:
  61.   X_Screen(void);
  62.   virtual int        new_window(Frame*);
  63.   virtual void        make_closest(int);
  64.   virtual void        get_window_device_frame(int,Frame*);
  65.   virtual void        set_current_window(int);
  66.   virtual void        set_pen_color(color);
  67.   virtual void        fill_window(void);
  68.   virtual void        move_to(Coord2*);
  69.   virtual void        draw_to(Coord2*);
  70.   virtual void        draw_line(Coord2*,Coord2*);
  71.   virtual boolean    mouse_button_is_down(void);
  72.   virtual void        wait(void);
  73.   virtual            ~X_Screen(void);
  74. };
  75.   
  76. #endif
  77.